﻿using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

namespace Tools
{

    /// <summary>
    /// 用来创建扩展功能的按钮
    /// </summary>
    public class EditorUIMenu : Editor
    {

        [MenuItem("GameObject/UI/EzButton（可双击按钮）", priority = 500)]
        static void CreateEzButton()
        {

            GameObject[] objs = Selection.gameObjects;
            if (objs.Length > 0)
            {
                for (int i = 0; i < objs.Length; i++)
                {
                    GameObject obj = Resources.Load<GameObject>("EzUI/EzButton");
                    GameObject temp = Instantiate(obj, objs[i].transform);
                    temp.name = obj.name;
                    temp.transform.localPosition = Vector3.zero;
                }
            }
        }

        [MenuItem("GameObject/UI/EzToggleButton（预制Toggle）", priority = 500)]
        static void CreateEzToggleButton()
        {

            GameObject[] objs = Selection.gameObjects;
            if (objs.Length > 0)
            {
                for (int i = 0; i < objs.Length; i++)
                {
                    GameObject obj = Resources.Load<GameObject>("EzUI/EzToggle");
                    GameObject temp = Instantiate(obj, objs[i].transform);
                    temp.name = obj.name;
                    temp.transform.localPosition = Vector3.zero;
                }
            }
        }
    }

}
